package com.example.cameraapp.activity;

import android.content.Intent;
import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;

import com.example.cameraapp.R;
import com.example.cameraapp.fragment.MyAlbumFragmentAdapter;


public class AlbumActivity extends AppCompatActivity {

    private ViewPager viewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_album);
        initEvent();
    }

    private void initEvent() {
        MyAlbumFragmentAdapter adapter = new MyAlbumFragmentAdapter(getSupportFragmentManager());
        viewPager = findViewById(R.id.viewPaper_layout);
        viewPager.setAdapter(adapter);
        viewPager.setCurrentItem(0);
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        Intent intent = new Intent(this, SunCameraActivity.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
    }
}